package cn.sylinx.common.ext.exception;

public class WrappedExceptionCatcher {

	public static <T extends Object> T run(GenericsCatcher<T> gc) {

		try {
			return gc.run();
		} catch (Exception e) {
			
			String errorMsg = "系统异常，请稍候重试！" ;
			if(e instanceof NullPointerException) {
				errorMsg = "空指针异常";
			} else {
				errorMsg = "异常：" + e.getMessage();
			}
			
			throw new WrappedException(errorMsg);
		}
	}
}
